package com.dm.entity;

import javax.persistence.*;
import java.sql.Timestamp;
import java.util.List;

/**
 * @author hqw521@qq.com
 * @date 2018/11/12 20:35
 */
@Entity
@Table(name = "dm_user", schema = "dm", catalog = "")
public class User {
    private int userId;
    private String userName;
    private String password;
    private String userType;
    private Timestamp createTime;
    private Timestamp updateTime;
    private List<File> dmFilesByUserId;
    private List<Folder> dmFoldersByUserId;
    private List<Record> dmRecordsByUserId;

    @Id
    @Column(name = "user_id", nullable = false)
    public int getUserId() {
        return userId;
    }

    public void setUserId(int userId) {
        this.userId = userId;
    }

    @Basic
    @Column(name = "user_name", nullable = false, length = 20)
    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    @Basic
    @Column(name = "password", nullable = false, length = 8)
    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    @Basic
    @Column(name = "user_type", nullable = true, length = 255)
    public String getUserType() {
        return userType;
    }

    public void setUserType(String userType) {
        this.userType = userType;
    }

    @Basic
    @Column(name = "create_time", nullable = true)
    public Timestamp getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Timestamp createTime) {
        this.createTime = createTime;
    }

    @Basic
    @Column(name = "update_time", nullable = true)
    public Timestamp getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Timestamp updateTime) {
        this.updateTime = updateTime;
    }

    @OneToMany(mappedBy = "dmUserByUserId")
    public List<File> getDmFilesByUserId() {
        return dmFilesByUserId;
    }

    public void setDmFilesByUserId(List<File> dmFilesByUserId) {
        this.dmFilesByUserId = dmFilesByUserId;
    }

    @OneToMany(mappedBy = "dmUserByUserId")
    public List<Folder> getDmFoldersByUserId() {
        return dmFoldersByUserId;
    }

    public void setDmFoldersByUserId(List<Folder> dmFoldersByUserId) {
        this.dmFoldersByUserId = dmFoldersByUserId;
    }

    @OneToMany(mappedBy = "dmUserByUserId")
    public List<Record> getDmRecordsByUserId() {
        return dmRecordsByUserId;
    }

    public void setDmRecordsByUserId(List<Record> dmRecordsByUserId) {
        this.dmRecordsByUserId = dmRecordsByUserId;
    }
}
